﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
using BHair.Business;
using BHair.Base;
using BHair.Report;
using BHair.kucunpandian;
using BHair.xitong;
using System.Diagnostics;

namespace BHair
{
    public partial class frmzhuchuang : Form
    {
        public frmzhuchuang()
        {
            InitializeComponent();
        }
        //读取配置文件获取数据库连接
        string constr = ConfigurationManager.ConnectionStrings["BHair.Properties.Settings.BHairDBConnectionString"].ConnectionString;
        private void frmzhuchuang_Load(object sender, EventArgs e)
        {
            //new Sunisoft.IrisSkin.SkinEngine().SkinFile = "skins/DeepCyan.ssk";
            this.timer1.Enabled = true;
            this.timer1.Interval = 1000;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            DateTime dt = DateTime.Now;
            string xingqi = "";
            if (dt.DayOfWeek.ToString() == "Monday")
            {
                xingqi = "周一";
            }
            else if (dt.DayOfWeek.ToString() == "Tuesday")
            {
                xingqi = "周二";
            }
            else if (dt.DayOfWeek.ToString() == "Wednesday")
            {
                xingqi = "周三";
            } else if (dt.DayOfWeek.ToString() == "Thursday")
            {
                xingqi = "周四";
            } else if (dt.DayOfWeek.ToString() == "Friday")
            {
                xingqi = "周五";
            } else if (dt.DayOfWeek.ToString()== "Saturday")
            {
                xingqi = "周六";
            }else if(dt.DayOfWeek.ToString()== "Sunday")
            {
                xingqi = "周日";
            }
            this.toolStripStatusLabel4.Text = dt.ToString() +" 星期："+ xingqi;
            this.toolStripStatusLabel6.Text = chuanzhi.userID;
        }

        private void 导航窗体ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            xtraTabControl1.SelectedTabPage = xtraTabPage1;
        }
        #region 开班
        private void button1_Click(object sender, EventArgs e)
        {
            
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [kaiban] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["kaiban"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                if (chuanzhi.banzu == string.Empty)
                {

                    /*frmPays_List xf = new frmPays_List();
                    xf.Show(this.dockPanel1);
                    xf.Text = "消费管理";
                    */

                    frmkaiban kai = new frmkaiban();
                    kai.Show();
                    chuanzhi cz = new chuanzhi();
                    cz.rizhi("打开当班");
                }
                else
                {
                    MessageBox.Show("已经开过班请先交班！");
                }
            }
        }
        #endregion
        #region 会员管理
        private void button2_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [huiyuanguanli] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["huiyuanguanli"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                // frmMember_List hyfl = new frmMember_List();
                //hyfl.Show(this.dockPanel1);
                //hyfl.Text = "会员管理";
                frmmembernew mn = new frmmembernew();
                mn.Show(this.dockPanel1);
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开会员管理");
            }
        }
        #endregion
        #region 项目管理
        private void button3_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [spsz] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["spsz"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                //frmItems_List sp = new frmItems_List();
                frmsplist sp = new frmsplist();
                sp.Show(this.dockPanel1);
                sp.Text = "项目商品设置";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开项目管理");

            }
            
        }
        #endregion
        #region 直接扣款
        private void button4_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT[zjkk]FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["zjkk"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                
                    //xtraTabControl1.SelectedTabPage = xtraTabPage2;
                    frmzjkf zj = new frmzjkf();
                    zj.ShowDialog();
                    chuanzhi cz = new chuanzhi();
                    cz.rizhi("打开直接扣费");
               
            }
            
        }
        #endregion
        #region 计次消费
        private void button5_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            string sql = string.Format("SELECT[jcxf]FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            conn.Open();
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["jcxf"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                
                    //xtraTabControl1.SelectedTabPage = xtraTabPage2;
                    // Frmjcxf jc = new Frmjcxf();
                    frmjcxfNew jc = new frmjcxfNew();
                    jc.ShowDialog();
                    chuanzhi cz = new chuanzhi();
                    cz.rizhi("打开计次消费");
              
            }
            
        }
        #endregion
        #region 商品入库
        private void button6_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [sprk] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["sprk"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmjinhuo rk = new frmjinhuo();
                rk.Show(this.dockPanel1);
                rk.Text = "商品入库";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开商品入库");
            }
           
        }
        #endregion
        #region 更换用户
        private void 更换用户ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            /* frmghyh gh = new frmghyh();
             gh.ShowDialog();
             chuanzhi cz = new chuanzhi();
             cz.rizhi("更换用户");
             */
            frmLogin lo = new frmLogin();
            lo.ShowDialog();
        }
        #endregion

        #region 关闭按钮和最小化按钮
        private void button8_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button7_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        #endregion
        #region 会员分类
        private void 会员分类ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [spfl] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["spfl"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                frmspfl fl = new frmspfl();
                fl.Show();
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开商品分类");
            }
            }
        #endregion
        #region 项目管理
        private void 项目管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [spsz] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["spsz"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmsplist sp = new frmsplist();
                sp.Show(this.dockPanel1);
                sp.Text = "项目商品设置";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开项目管理");

            }
        }
        #endregion


        #region 商品销售明细
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [xsmx] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["xsmx"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmxsmx xsmx = new frmxsmx();
                xsmx.Show(this.dockPanel1);
                xsmx.Text = "销售明细表";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开销售明细表");
            }
        }
        #endregion

        private void 用户设置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [yhsz] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["yhsz"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {

                Frmuser user = new Frmuser();
                user.ShowDialog();
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开用户权限");
            }
        }
        #region 库存报表
        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [kcbb] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["kcbb"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmkcbb kc = new frmkcbb();

                kc.Show(this.dockPanel1);
                kc.Text = "库存报表";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开库存报表");
            }
        }
        #endregion

        #region 进货明细
        private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [jhmx] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["jhmx"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmjhmx jh = new frmjhmx();
                jh.Show(this.dockPanel1);
                jh.Text = "商品进货明细";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开商品进货明细");

            }
        }
        #endregion

        private void 库存盘点ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [kcpd] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["kcpd"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmkcpd pd = new frmkcpd();
                pd.Show(this.dockPanel1);
                pd.Text = "库存盘点";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开库存盘点");
            }
        }

        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [jcxfmx] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx =Int32.Parse(sdr["jcxfmx"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmjcxfmx jcmx = new frmjcxfmx();
                jcmx.Show(this.dockPanel1);
                jcmx.Text = "计次消费明细";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开计次消费明细");
            }
        }

        private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            frmkcpdtable kcpd = new frmkcpdtable();
            kcpd.Show(this.dockPanel1);
            kcpd.Text = "库存盘点查询";
            chuanzhi cz = new chuanzhi();
            cz.rizhi("打开库存盘点查询");
        }

        private void button9_Click(object sender, EventArgs e)
        {
            xtraTabControl1.SelectedTabPage = xtraTabPage1;
        }

        private void button11_Click(object sender, EventArgs e)
        {
            xtraTabControl1.SelectedTabPage = xtraTabPage3;
        }

        private void button12_Click(object sender, EventArgs e)
        {
            xtraTabControl1.SelectedTabPage = xtraTabPage4;
        }

        private void button10_Click(object sender, EventArgs e)
        {
            xtraTabControl1.SelectedTabPage = xtraTabPage5;
        }

        private void button13_Click(object sender, EventArgs e)
        {
            xtraTabControl1.SelectedTabPage = xtraTabPage6;
        }

        private void button14_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [ygsz] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["ygsz"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmEmployee_List fely = new frmEmployee_List();
                fely.Show(this.dockPanel1);
                fely.Text = "职员管理";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开员工管理");
            }
        }

        private void button17_Click(object sender, EventArgs e)
        {
            xtraTabControl1.SelectedTabPage = xtraTabPage7;
        }

        private void button19_Click(object sender, EventArgs e)
        {
            frmMember mb = new frmMember();
            mb.ShowDialog();
            chuanzhi cz = new chuanzhi();
            cz.rizhi("打开会员发卡");
        }

        private void button20_Click(object sender, EventArgs e)
        {
            
                frmhycz cz = new frmhycz();
                cz.ShowDialog();
                chuanzhi cz1 = new chuanzhi();
                cz1.rizhi("打开会员储值");
          
        }

        private void button21_Click(object sender, EventArgs e)
        {
            
                frmjccz jc = new frmjccz();
                jc.ShowDialog();
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开会员项目充次");
           
        }

        private void button23_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [收入明细] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["收入明细"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmsrmx sr = new frmsrmx();

                sr.Show(this.dockPanel1);
                sr.Text = "收入明细表";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开收入明细表");
            }
        }

        private void button24_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [spfl] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["spfl"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                //frmspfl fl = new frmspfl();
                //fl.Show();
                //chuanzhi cz = new chuanzhi();
                //cz.rizhi("打开商品分类");
                frmfllist li = new frmfllist();
                li.Show();
            }
        }

        private void button25_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [xiaofei] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["xiaofei"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                if (chuanzhi.banzu != string.Empty)
                {
                    frmxs xs = new frmxs();
                    xs.Show();
                    chuanzhi cz = new chuanzhi();
                    cz.rizhi("打开会员消费单");
                }
                else
                {
                    MessageBox.Show("请先开班！");
                }
            }
        }

        private void button26_Click(object sender, EventArgs e)
        {
            if (chuanzhi.banzu != string.Empty)
            {
                frmxuqi xq = new frmxuqi();
                xq.Show();
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开会员续期");
            }
            else
            {
                MessageBox.Show("请先开班！");
            }

        }

        private void button28_Click(object sender, EventArgs e)
        {
            if (chuanzhi.banzu != string.Empty)
            {
                frmjiaoban jb = new frmjiaoban();
                jb.Show();
                chuanzhi cz = new chuanzhi();
                cz.rizhi("交班");
            }
            else
            {
                MessageBox.Show("没有开班记录！无需交班！");
            }
        }

        private void button29_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [kcbb] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["kcbb"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmkcbb kc = new frmkcbb();

                kc.Show(this.dockPanel1);
                kc.Text = "库存报表";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开库存报表");
            }
        }

        private void button22_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [xsmx] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["xsmx"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmxsmx xsmx = new frmxsmx();
                xsmx.Show(this.dockPanel1);
                xsmx.Text = "销售明细表";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开销售明细表");
            }
        }

        private void button30_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [jhmx] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["jhmx"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmjhmx jh = new frmjhmx();
                jh.Show(this.dockPanel1);
                jh.Text = "商品进货明细";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开商品进货明细");


            }
        }

        private void button31_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [jcxfmx] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["jcxfmx"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmjcxfmx jcmx = new frmjcxfmx();
                jcmx.Show(this.dockPanel1);
                jcmx.Text = "计次消费明细";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开计次消费明细表");
            }
        }

        private void button32_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [hycztj] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["hycztj"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmhyczmx cz = new frmhyczmx();
                cz.Show(this.dockPanel1);
                cz.Text = "会员充值报表";
                chuanzhi cz1 = new chuanzhi();
                cz1.rizhi("打开会员充值表");
            }
        }

        private void button27_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [yhsz] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["yhsz"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {

                Frmuser user = new Frmuser();
                user.ShowDialog();
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开用户权限");
            }
        }

        private void button15_Click(object sender, EventArgs e)
        {
            frmbak bak = new frmbak();
            bak.Show();
        }

        private void button16_Click(object sender, EventArgs e)
        {
            frmhf hf = new frmhf();
            hf.Show();
            chuanzhi cz = new chuanzhi();
            cz.rizhi("数据还原");
        }

        private void 直接扣款ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT[zjkk]FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["zjkk"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                if (chuanzhi.banzu != string.Empty)
                {
                    xtraTabControl1.SelectedTabPage = xtraTabPage2;
                    frmzjkf zj = new frmzjkf();
                    zj.ShowDialog();
                    chuanzhi cz = new chuanzhi();
                    cz.rizhi("打开直接扣款");
                }
                else
                {
                    MessageBox.Show("请先开班！");
                }
            }
        }

        private void 会员消费ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [xiaofei] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["xiaofei"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                if (chuanzhi.banzu != string.Empty)
                {
                    frmxs xs = new frmxs();
                    xs.Show();
                    chuanzhi cz = new chuanzhi();
                    cz.rizhi("打开会员消费");
                }
                else
                {
                    MessageBox.Show("请先开班！");
                }
            }
           
        }

        private void 会员管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [huiyuanguanli] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["huiyuanguanli"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmMember_List hyfl = new frmMember_List();
                hyfl.Show(this.dockPanel1);
                hyfl.Text = "会员管理";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开会员管理");
            }
        }

        private void 计次消费ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            string sql = string.Format("SELECT[jcxf]FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            conn.Open();
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["jcxf"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                if (chuanzhi.banzu != string.Empty)
                {
                    xtraTabControl1.SelectedTabPage = xtraTabPage2;
                    // Frmjcxf jc = new Frmjcxf();
                    frmjcxfNew jc = new frmjcxfNew();
                    jc.Show();
                    chuanzhi cz = new chuanzhi();
                    cz.rizhi("打开计次消费");
                }
                else
                {
                    MessageBox.Show("请先开班！");
                }
            }
        }

        private void 商品进货ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [sprk] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["sprk"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmjinhuo rk = new frmjinhuo();
                rk.Show(this.dockPanel1);
                rk.Text = "商品入库";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开商品入库");
            }

        }

        private void button33_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [kcpd] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["kcpd"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmkcpd pd = new frmkcpd();
                pd.Show(this.dockPanel1);
                pd.Text = "库存盘点";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开库存盘点");
            }
        }

        private void 职员管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [ygsz] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["ygsz"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmEmployee_List fely = new frmEmployee_List();
                fely.Show(this.dockPanel1);
                fely.Text = "职员管理";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开职员管理");
            }
        }

        private void 商品销售明细ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [xsmx] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["xsmx"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmxsmx xsmx = new frmxsmx();
                xsmx.Show(this.dockPanel1);
                xsmx.Text = "销售明细表";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开销售明细表");
            }
        }

        private void 商品库存明细ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [kcbb] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["kcbb"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmkcbb kc = new frmkcbb();

                kc.Show(this.dockPanel1);
                kc.Text = "库存报表";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开库存报表");
            }
        }

        private void 商品进货明细ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [jhmx] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["jhmx"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmjhmx jh = new frmjhmx();
                jh.Show(this.dockPanel1);
                jh.Text = "商品进货明细";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开商品进货明细");


            }
        }

        private void 计次项目明细ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [jcxfmx] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["jcxfmx"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmjcxfmx jcmx = new frmjcxfmx();
                jcmx.Show(this.dockPanel1);
                jcmx.Text = "计次消费明细";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开计次消费明细");
            }
        }

        private void 会员充值明细ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [hycztj] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["hycztj"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmhyczmx cz = new frmhyczmx();
                cz.Show(this.dockPanel1);
                cz.Text = "会员充值报表";
                chuanzhi cz1 = new chuanzhi();
                cz1.rizhi("打开会员充值报表");
            }
        }

        private void 营业收银明细ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [收入明细] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            int qx = 0;
            SqlDataReader sdr = comm.ExecuteReader();
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["收入明细"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                xtraTabControl1.SelectedTabPage = xtraTabPage2;
                frmsrmx sr = new frmsrmx();

                sr.Show(this.dockPanel1);
                sr.Text = "收入明细表";
                chuanzhi cz = new chuanzhi();
                cz.rizhi("打开收入明细表");
            }
        }

        private void 数据备份ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmbak bak = new frmbak();
            bak.ShowDialog();
        }

        private void 数据恢复ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmhf hf = new frmhf();
            hf.ShowDialog();
        }

        private void button18_Click(object sender, EventArgs e)
        {
            frmhyfl fl = new frmhyfl();
            fl.ShowDialog();
            chuanzhi cz = new chuanzhi();
            cz.rizhi("打开会员卡分类");
        }

        private void 更改密码ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmupdatepwd pwd = new frmupdatepwd();
            pwd.ShowDialog();
            chuanzhi cz = new chuanzhi();
            cz.rizhi("更改密码");
        }

        private void 系统配置ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 退出系统ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            chuanzhi cz = new chuanzhi();
            cz.rizhi("退出系统");
            this.Close();
        }

        private void 系统日志ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            chuanzhi cz = new chuanzhi();
            cz.rizhi("打开系统日志");
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            frmrizhi rz = new frmrizhi();
            
            rz.Show(this.dockPanel1);
            rz.Text = "系统日志";
        }

        private void button34_Click(object sender, EventArgs e)
        {
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            frmjcczmx mx = new frmjcczmx();
            mx.Show(this.dockPanel1);
            mx.Text = "项目充值明细";
        }

        private void 软件注册ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmzhuce zc = new frmzhuce();
            zc.ShowDialog();
        }

        private void button35_Click(object sender, EventArgs e)
        {
            frmyczh zh = new frmyczh();
            zh.ShowDialog();
        }

        private void button36_Click(object sender, EventArgs e)
        {
            //frmkafenleixiaofeitongji fl = new frmkafenleixiaofeitongji();
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            frmckdtab tt = new frmckdtab();
            tt.Show(this.dockPanel1);
            tt.Text = "出库单";
           // fl.Show(this.dockPanel1);
            //fl.Text = "卡分类消费统计";
        }

        private void button37_Click(object sender, EventArgs e)
        {
           // frmxiangmuxiaofeihuizong hz = new frmxiangmuxiaofeihuizong();
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            frmqtcktab ta = new frmqtcktab();
            ta.Show(this.dockPanel1);
            ta.Text = "出库明细";
           // hz.Show(this.dockPanel1);
            //hz.Text = "计次项目消费统计";
        }

        private void button38_Click(object sender, EventArgs e)
        {
            frmfakatongji tj = new frmfakatongji();
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            tj.Show(this.dockPanel1);
            tj.Text = "发卡统计";
        }

        private void 数据升级ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                SqlConnection conn = new SqlConnection(constr);
                SqlConnection conn1 = new SqlConnection(constr);
                SqlConnection conn2 = new SqlConnection(constr);
                SqlConnection conn3 = new SqlConnection(constr);

                conn.Open();
                conn1.Open();
                conn2.Open();
                conn3.Open();
                //修改卡类别中的金额数据类型为两位小数
                string sql = "alter table card alter column cmoney decimal(18,2)";
                SqlCommand comm = new SqlCommand(sql, conn);
                comm.ExecuteNonQuery();
                string sql1 = "alter table djh add bk nvarchar(50)";
                SqlCommand comm1 = new SqlCommand(sql1, conn1);
                comm1.ExecuteNonQuery();
                string sql2 = "UPDATE djh SET bk = '00000'";
                SqlCommand comm2 = new SqlCommand(sql2, conn2);
                comm2.ExecuteNonQuery();
                string sql3 = "CREATE TABLE [dbo].[ycxm] ([id] [int] IDENTITY (1, 1) NOT NULL ,[cardID] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,[jcspid] [int] NULL ,[jcnum] [int] NULL ) ON [PRIMARY]";
                SqlCommand comm3 = new SqlCommand(sql3, conn3);
                comm3.ExecuteNonQuery();
                MessageBox.Show("升级成功");
                conn.Close();
                conn1.Close();
                conn2.Close();
                conn3.Close();
            }
            catch
            {
                MessageBox.Show("无需升级");
            }
        }

        private void 数据清理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmshujuqingli ql = new frmshujuqingli();
            ql.ShowDialog();
        }

        private void button39_Click(object sender, EventArgs e)
        {
            frmhyzk zk = new frmhyzk();
            zk.ShowDialog();
        }

        private void button40_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT [jcxmgl] FROM [BHairDB].[dbo].[LoginUser] where LoginUserID='{0}'", chuanzhi.userID);
            SqlCommand comm = new SqlCommand(sql, conn);
            SqlDataReader sdr = comm.ExecuteReader();
            int qx = 0;
            while (sdr.Read())
            {
                qx = Int32.Parse(sdr["jcxmgl"].ToString().Trim());
            }
            if (qx == 0)
            {
                MessageBox.Show("无此权限");
            }
            else
            {
                frmjcgl gl = new frmjcgl();
                gl.ShowDialog();
                chuanzhi cz = new chuanzhi();
                cz.rizhi("计次项目管理");
            }
            
        }

        private void button41_Click(object sender, EventArgs e)
        {
            frmtuihuo t = new frmtuihuo();
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            t.Show(this.dockPanel1);
            t.Text="退/冲查询";
        }

        private void button42_Click(object sender, EventArgs e)
        {
            Frmcishufenxi fx = new Frmcishufenxi();
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            fx.Show(this.dockPanel1);
            fx.Text = "次数分析";
        }

        private void button43_Click(object sender, EventArgs e)
        {
            顾客来店统计表 g = new 顾客来店统计表();
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            g.Show(this.dockPanel1);
            g.Text = "顾客来店统计表";
        }

        private void button44_Click(object sender, EventArgs e)
        {
            frmtizhongbianhua bh = new frmtizhongbianhua();
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            bh.Show(this.dockPanel1);
            bh.Text = "体重差额表";
        }

        private void frmzhuchuang_FormClosing(object sender, FormClosingEventArgs e)
        {
            System.Environment.Exit(0);
        }

        private void button45_Click(object sender, EventArgs e)
        {
            frmycxmbb yc = new frmycxmbb();
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            yc.Show(this.dockPanel1);
            yc.Text = "预存项目表";
        }

        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            frmcarddaoru dr = new frmcarddaoru();
            dr.ShowDialog();
        }

        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {
            frmxiangmupipei pip = new frmxiangmupipei();
            pip.ShowDialog();
        }

        private void 项目转换ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frm项目转换 xm = new frm项目转换();
            xm.ShowDialog();
        }
        private static System.Diagnostics.Process p;
        private void 检测更新ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("真的要执行此操作吗？", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
            if (dr == DialogResult.OK) //用户单击了“确定”返回的值
            {
                //你要执行的操作
                if (p == null)
                {
                    string path = @"./AutoUpdate.exe";
                    p = new System.Diagnostics.Process();
                    p.StartInfo.FileName = "AutoUpdate.exe";
                    p.StartInfo.WorkingDirectory = path;
                     p.Start();
                }
                else
                {
                    if (p.HasExited) //是否正在运行
                    {
                        p.Start();
                    }
                }
                p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
            }
        }

        private void button46_Click(object sender, EventArgs e)
        {
            frmxqtab xq = new frmxqtab();
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            xq.Show(this.dockPanel1);
            xq.Text = "延期续期表";
        }

        private void button47_Click(object sender, EventArgs e)
        {
            frmqtck ck = new frmqtck();
            ck.ShowDialog();
        }

        private void button47_Click_1(object sender, EventArgs e)
        {
            frmqtck ck = new frmqtck();
            ck.ShowDialog();
        }

        private void button48_Click(object sender, EventArgs e)
        {
            frmkafenleixiaofeitongji fl = new frmkafenleixiaofeitongji();
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            fl.Show(this.dockPanel1);
            fl.Text = "卡消费次数分析";
        }

        private void button49_Click(object sender, EventArgs e)
        {
            frm卡过期查询 gq = new frm卡过期查询();
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            gq.Show(this.dockPanel1);
            gq.Text="卡效期查询";
        }

        private void button50_Click(object sender, EventArgs e)
        {
            frm会员级别 jb = new frm会员级别();
            jb.ShowDialog();
        }

        private void button51_Click(object sender, EventArgs e)
        {
            积分流水表 jf = new 积分流水表();
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            jf.Show(this.dockPanel1);
        }
    }

}
